import logging

from fastapi import APIRouter, Depends

from app.models.theme_model import ThemeModel

from app.services.theme_service import ThemeService, theme_service
from app.utils.response_result import resp_500, resp_200

router = APIRouter()


# 新增配置
@router.post("/query")
def query_theme(themeModel: ThemeModel, themeService: ThemeService = Depends(lambda: theme_service)):
    try:
        data = themeService.query_theme(themeModel)
        return resp_200(data=data)
    except Exception as e:
        logging.error(f"主题查询接口异常:{str(e)}")
        return resp_500(message=f"主题查询接口异常:{str(e)}")
